package org.yzl.designPatterns.iterator;

import org.yzl.designPatterns.iterator.impl.CollectionImpl;

/**
 * 迭代器模式
 * 一是需要遍历的对象，即聚集对象，二是迭代器对象，用于对聚集对象进行遍历访问
 */
public class IteratorTest {
    public static void main(String[] args) {
        String strings[] = {"A","B","C","D","E","F"};
        ICollection collection = new CollectionImpl(strings);
        System.out.println(collection.size());

        IIterator iIterator = collection.iterator();
        while (iIterator.hasNext()){
            System.out.println(iIterator.next());
        }
    }
}
